<template>
  <div class="lang">
    <span
      v-if="$i18n.locale === 'zh'"
      class="iconfont  icon-zhongwenyuyan"
      @click="changeLang"
    />
    <span v-else class="iconfont icon-yingwenyuyan" @click="changeLang" />
  </div>
</template>

<script>
import cookie from 'js-cookie'
export default {
  data() {
    return {
      // isShow: true
    }
  },

  methods: {
    changeLang() {
      // console.log(this.$i18n.locale)
      // this.isShow = !this.isShow
      if (this.$i18n.locale === 'zh') {
        this.$i18n.locale = 'en'
        // console.log(1)
      } else if (this.$i18n.locale === 'en') {
        this.$i18n.locale = 'zh'
        // console.log(2)
      }

      // console.log(this.$i18n.locale)
      cookie.set('locale', this.$i18n.locale)
      // this.$router.go(0)
    }
  }
}
</script>

<style lang="scss" scoped>
.lang {
  span {
    font-size: 22px;
    margin-right: 10px;
  }
}
</style>
